
# MOSEK library detection
FIND_PATH(MOSEK_INCLUDE NAMES mosek.h PATHS ${MOSEK_SEARCH_HEADER})
FIND_LIBRARY(MOSEK_LIB NAMES libmosek libmosek.so libmosek64 libmosek64.so PATHS ${MOSEK_SEARCH_LIB})

IF (EXISTS ${MOSEK_INCLUDE} AND EXISTS ${MOSEK_LIB})

  SET(MOSEK_FOUND   true  CACHE BOOL "USE MOSEK library")
  MESSAGE("-- Found Mosek header in: ${MOSEK_INCLUDE}")
  MESSAGE("-- Found Mosek library: ${MOSEK_LIB}")
#  INCLUDE_DIRECTORIES( ${MOSEK_INCLUDE} )

  IF (${UNIX})
    FIND_PACKAGE(Threads REQUIRED)
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_THREAD_LIBS_INIT}")
    LIST(APPEND ${MOSEK_LIB} pthread)
  ENDIF (${UNIX})

#  ADD_DEFINITIONS(-DOPENMVG_HAVE_MOSEK)

ELSE (EXISTS ${MOSEK_INCLUDE} AND EXISTS ${MOSEK_LIB})
  MESSAGE("-- Did not find MOSEK header")
  IF (NOT EXISTS ${MOSEK_LIB})
    MESSAGE("-- Did not find MOSEK library")
  ENDIF ()
ENDIF (EXISTS ${MOSEK_INCLUDE} AND EXISTS ${MOSEK_LIB})

IF(NOT MOSEK_FOUND)
      MESSAGE(STATUS "Could not find mosek library on this machine.")
ENDIF(NOT MOSEK_FOUND)

MARK_AS_ADVANCED(MOSEK_FOUND)

